//
//  FulisheJifenListController.m
//  ToListenPhone
//
//  Created by zhibao on 2023/7/20.
//

#import "FLSJifenListController.h"
#import "FulisheJifenListCell.h"

@interface FLSJifenListController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,strong) MYTableView *showTableView;
@property(nonatomic,strong)NSMutableArray *dataArray;
@end

@implementation FLSJifenListController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.gk_statusBarStyle = UIStatusBarStyleDarkContent;
    self.gk_navTitleColor = MYBlock;
    self.gk_backImage = [UIImage imageNamed:@"arrow_back"];
    self.view.backgroundColor = UIColor.whiteColor;
    self.gk_navBackgroundColor = UIColor.whiteColor;
    self.gk_navTitle = @"积分明细";
    [self initTableview];
    _dataArray = [NSMutableArray new];
    __weak __typeof(self)weakSelf = self;
    [[HttpHelper sharedInstance] sendGet:@"api/integral/detail" parameters:@{} success:^(NSURLSessionTask * _Nonnull operation, ResponseModel * _Nonnull responseObject) {
        __strong __typeof(weakSelf)strongSelf = weakSelf;
        strongSelf.dataArray = responseObject.data[@"data"];
        [strongSelf.showTableView reloadData];
    } failure:^(NSURLSessionTask * _Nonnull operation, NSError * _Nonnull error) {
        
    }];
}
-(void)initTableview{
    self.showTableView = [[MYTableView alloc]initWithFrame:CGRectMake(0,NAVIH, MY_Screen_W, MY_Screen_H - NAVIH) style:UITableViewStylePlain];
    self.showTableView.delegate = self;
    self.showTableView.dataSource = self;
    self.showTableView.backgroundColor = [UIColor clearColor];
    self.showTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.showTableView removeMJRefresh];
    [self.view addSubview:self.showTableView];
    [self.showTableView reloadData];
    [self.showTableView.nodataView removeFromSuperview];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [_dataArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *identifier=@"FulisheJifenListCell";
    FulisheJifenListCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell==nil) {
        cell=[[FulisheJifenListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
    }
    [cell update:_dataArray[indexPath.row]];
    return cell;
}


@end
